<template>
  <div class="about">
    <!-- <h1>{{$store.state.count}}</h1> -->
    <input type="text" v-model="text">
    <div v-for="(value,index) in $store.state.a.count" :key="index">
      <p>{{value.name}}</p>
      <button @click="xiugai('name',index)">修改</button>
      <p>{{value.age}}</p>
      <button @click="xiugai('age',index)">修改</button>
    </div>
  </div>
</template>
<script>
export default {
  name: "about",
  data() {
    return {
      text: '',
    };
  },
  methods: {
    add(){
      this.$store.commit('xiu',10);
    },
    xiugai(typeName,index){
      let arr=this.$store.state.count[index];
      arr[typeName]=this.text;
      this.$store.commit('state',arr,index);
    }
  }
};
</script>
